/**
 * The styles in this file are only structural for Seelenweg,
 * all the design should be added to the default theme css.
 */
body {
  overflow: hidden;
  cursor: default;
  background: transparent;
  display: flex;
  justify-content: var(--config-by-position-justify-content);
  align-items: var(--config-by-position-align-items);
  width: 100vw;
  height: 100vh;
}

/** Root Styles */
#root {
  --position-when-hidden: calc(
    (var(--config-item-size) + ((var(--config-padding) + var(--config-margin)) * 2)) * -1
  );
  position: absolute;
  height: min-content;
  width: min-content;
  transition-property: top, left, right, bottom;
  transition-duration: 200ms;
  transition-timing-function: ease-in-out;

  &:has(.taskbar.delayed) {
    transition-delay: var(--config-time-before-hide);
    &:hover {
      transition-delay: var(--config-time-before-show);
    }
  }

  &:has(.taskbar.hidden)::after {
    content: "";
    position: fixed;
  }

  &:has(.taskbar.left) {
    left: 0;
    &::after {
      bottom: 0;
      left: 0;
      width: 1px;
      height: 100vh;
    }
  }

  &:has(.taskbar.right) {
    right: 0;
    &::after {
      top: 0;
      right: 0;
      width: 1px;
      height: 100vh;
    }
  }

  &:has(.taskbar.top) {
    top: 0;
    &::after {
      top: 0;
      right: 0;
      width: 100vw;
      height: 1px;
    }
  }

  &:has(.taskbar.bottom) {
    bottom: 0;
    &::after {
      bottom: 0;
      left: 0;
      width: 100vw;
      height: 1px;
    }
  }

  &:not(:hover) {
    &:has(.taskbar.hidden.left) {
      left: var(--position-when-hidden);
    }

    &:has(.taskbar.hidden.right) {
      right: var(--position-when-hidden);
    }

    &:has(.taskbar.hidden.top) {
      top: var(--position-when-hidden);
    }

    &:has(.taskbar.hidden.bottom) {
      bottom: var(--position-when-hidden);
    }
  }
}

/** Taskbar Styles */
.taskbar {
  position: relative;
  overflow: visible;
  padding: var(--config-padding);
  margin: var(--config-margin);
  display: flex;
  justify-content: var(--config-by-position-justify-content);
  align-items: var(--config-by-position-align-items);
  flex-direction: var(--config-by-position-flex-direction);
  gap: var(--config-space-between-items);

  &.horizontal {
    height: calc(var(--config-item-size) + var(--config-padding) * 2);
    width: min-content;

    &.full-width {
      width: calc(100vw - var(--config-margin) * 2);
    }
  }

  &.vertical {
    width: calc(var(--config-item-size) + var(--config-padding) * 2);
    height: min-content;

    &.full-width {
      height: calc(100vh - var(--config-margin) * 2);
    }
  }

  &:has(.weg-item-drag-container.dragging) {
    pointer-events: none;
  }

  .weg-separator {
    z-index: 1 !important; /* Override inline style */

    &:nth-child(2),
    &:last-child,
    &:not(.visible) {
      opacity: 0;
    }

    .vertical & {
      width: 100%;

      /* first child always is the background */
      &:nth-child(2) {
        margin-top: calc(var(--config-space-between-items) * -1);
      }

      &:last-child {
        margin-bottom: calc(var(--config-space-between-items) * -1);
      }
    }

    .horizontal & {
      height: 100%;

      /* first child always is the background */
      &:nth-child(2) {
        margin-left: calc(var(--config-space-between-items) * -1);
      }

      &:last-child {
        margin-right: calc(var(--config-space-between-items) * -1);
      }
    }
  }
}

.weg-item-preview-container {
  position: relative;
  max-width: 100vw;
  gap: var(--config-space-between-items);
  
  .weg-item-preview-scrollbar {
    display: flex;
    overflow-x: auto;

    &::-webkit-scrollbar {
      display: none;
    }
  }

  .weg-item-preview {
    z-index: 1;

    &:hover {
      filter: brightness(0.95);
      backdrop-filter: brightness(0.95);
    }

    .weg-item-preview-topbar {
      display: flex;
      width: 240px;
      justify-content: space-between;
      gap: 10px;

      .weg-item-preview-title {
        overflow: hidden;
        text-wrap: nowrap;
        text-overflow: ellipsis;
        flex: 1;
      }

      .weg-item-preview-close {
        border-radius: 6px;
        width: 20px;
        height: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 5px;

        &:hover {
          background-color: #0000005c;
        }
      }
    }

    .weg-item-preview-image-container {
      width: 240px;
      height: calc(240px / 1.77);
      display: flex;
      justify-content: center;
      align-items: center;

      .weg-item-preview-image {
        max-height: 100%;
        height: 100%;
        object-fit: scale-down;
      }
    }
  }
}
